
package com.starshineworks.util;

import java.io.File;
import com.db4o.*;
import com.db4o.cs.Db4oClientServer;

public class DbUtil {
        
    public static ObjectServer server = null;

    final public static String where = System.getProperty("user.home") + "/";

    final public static String DB4OFILENAME = where + "yyUI7834sdxew9.db4o";
        
    public static ObjectContainer openClient() 
    {
        if (server == null) {
             server = Db4oClientServer.openServer(Db4oClientServer.newServerConfiguration(), DB4OFILENAME, 0);
        }
        return server.openClient();
    }
    
    public static void reset() 
    {
        File f = new File(DB4OFILENAME);
        f.delete();
    }
    
    public static void dump()
    {
        ObjectContainer client = openClient();
        // XXXXX client.
        client.close();
    }
}
